package com.gopay.bis.web.controller;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.gopay.bis.service.bank.query.BisBankQueryService;

/**
 * 银行流水查询
 * 
 * @BisBankQueryController.java
 * @author yaobo
 * @2014-1-3 下午03:03:11 www.gopay.com.cn Inc.All rights reserved.
 */
@Controller
@Scope("prototype")
public class BisBankQueryController {
    @Resource(name = "bisBankQueryService")
    private BisBankQueryService bisBankQueryService;

    /**
     * 根据国付宝订单号获取银行流水
     * 
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/bisBankQuery")
    protected void execute(HttpServletRequest request, HttpServletResponse response) {
        String gopayOrderId = request.getParameter("gopayOrderId");

        String json = bisBankQueryService.getBankOrderForEnable(gopayOrderId);

        try {
            response.getWriter().print(json);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
